<?php
namespace App\Api\Models;

use Illuminate\Database\Eloquent\Model;

class SpeckillShoppingCard extends Model
{
    protected $table = 'cmc_speckillshoppingcards';

    public function seckill()
    {
        return $this->hasMany('cmc_store_seckill','seckill_id','id');
    }
    /**
     * 秒杀商品表查询
     * @param $user_id  //用户id
     * @param $allow_field  //查询的字段
     * @return array
     */
    public static function getSeckillList($user_id,$allow_field)
    {
        return self::join('cmc_store_seckill','cmc_speckillshoppingcards.seckill_id','=','cmc_store_seckill.id')
                    ->where('user_id',$user_id)
                    ->select($allow_field)
                    ->get()
                    ->toArray();
    }
}